/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Base;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Alina
 */
public class AyudanteDB {
        public boolean grabarAyudante(String cedula) throws SQLException {
        DatabaseManager db = new DatabaseManager();
        Connection var = db.getConnection();
        Statement stmt = var.createStatement();
        boolean resultado = stmt.execute("INSERT INTO AYUDANTE VALUES ('" + cedula + "')");
        var.commit();
        db.getConnection().close();
        return resultado;
    }
        
        public boolean buscarAyudante(String cedula) throws SQLException {
        
        DatabaseManager db = new DatabaseManager();
        Connection var = db.getConnection();
        Statement stmt = var.createStatement();
   
        String consulta = "SELECT * FROM AYUDANTE WHERE CEDULA_AYUDANTE='"+ cedula +"' "; 
        ResultSet resultado = stmt.executeQuery(consulta);
            while (resultado.next())
            {
                db.getConnection().close();
                return true;
            }
            
            db.getConnection().close();
            return false;
    }
}
